<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Course filter form base class.
 *
 * @package    FinalsClub
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 13459 2008-11-28 14:48:12Z fabien $
 */
class BaseCourseFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'          => new sfWidgetFormPropelChoice(array('model' => 'User', 'add_empty' => true)),
      'subject_id'       => new sfWidgetFormPropelChoice(array('model' => 'Subject', 'add_empty' => true)),
      'network_id'       => new sfWidgetFormFilterInput(),
      'instructor_name'  => new sfWidgetFormFilterInput(),
      'instructor_email' => new sfWidgetFormFilterInput(),
      'section'          => new sfWidgetFormFilterInput(),
      'name'             => new sfWidgetFormFilterInput(),
      'description'      => new sfWidgetFormFilterInput(),
      'tags'             => new sfWidgetFormFilterInput(),
      'status'           => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'user_id'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'User', 'column' => 'id')),
      'subject_id'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Subject', 'column' => 'id')),
      'network_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'instructor_name'  => new sfValidatorPass(array('required' => false)),
      'instructor_email' => new sfValidatorPass(array('required' => false)),
      'section'          => new sfValidatorPass(array('required' => false)),
      'name'             => new sfValidatorPass(array('required' => false)),
      'description'      => new sfValidatorPass(array('required' => false)),
      'tags'             => new sfValidatorPass(array('required' => false)),
      'status'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('course_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Course';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'user_id'          => 'ForeignKey',
      'subject_id'       => 'ForeignKey',
      'network_id'       => 'Number',
      'instructor_name'  => 'Text',
      'instructor_email' => 'Text',
      'section'          => 'Text',
      'name'             => 'Text',
      'description'      => 'Text',
      'tags'             => 'Text',
      'status'           => 'Number',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
